<?php
/**
 * User: LSM
 * Time: 12-10-13 - 上午9:14
 * File: index.inc.php
 * Project For ixdcw.com
 */

defined('IN_IXDCW') or exit('Access Denied');
require DT_CORE.'/'.$module.'/common.inc.php';
require_once DT_INC.'/post.func.php';
//引用公共头部模版
require DT_CORE.'/buyhelp/common.inc.php';
$navname='price';
ViewCheck::catExists() or Prompt::listNotFound();
ViewCheck::groupListPermission() or Prompt::noPermission();
require_once DT_INC . '/search/listAuto.inc.php';
$do = new PriceModule($moduleid);
//将结束时间小于今天的全部更改 状态。
$counts= $do->ChangeStatus();
$maincat = Search::mainCat(MODULE_NAME, $catid);
if (!empty($ARE)) {
	$mainarea=Xd_get_arealists($ARE);
} else {
	$mainarea[0] = get_mainarea(0);
}

$areaParentid = $ARE['parentid'];
//搜索
if ($kw) {
	SearchCheck::length($kw);
	SearchCheck::timeLimit();
}
$fds = $MOD['fields'];
$condition = "status=3";

// 地区搜索.
if ($areaid) {
	$condition .=  $ARE['child'] ? " AND areaid IN (".$ARE['arrchildid'].") " : " AND areaid=$areaid ";
}
//信息搜索list页面使用，之前的筛选页面用的，
//if ($kw) {
//	$condition .= " AND title LIKE '%$kw%'";
//}

if ($cartypeid == 1) {
    $localtypeid = 433;
}
if ($cartypeid == 2) {
    $localtypeid = 434;
}
//如果没有获取到对应的四车。默认值是乘用车
if(!$cartypeid||$cartypeid==0){
    $localtypeid=433;
}
//先去找缓存文件。
$total  = $db->count($table, $condition, $DT['cache_search']);
$levels = PCache::read('autoCategory-level.php');
if($total){
    $order=" order by p.edittime desc limit 10";
    $cityShai="";
    //本地
    $local_lev = $levels[$localtypeid]['arrchildid'];
    $localarea_condition=$do->getSQLInfo($local_lev,$cityid,$order);
    $localarea=$db->getAll($localarea_condition);
    //商用
    //卡车 445
    $kache_lev = $levels[445]['arrchildid'];
    $kache_condition=$do->getSQLInfo($kache_lev,$cityid,$order);
    $kache=$db->getAll($kache_condition);
    //客车 446
    $keche_lev = $levels[446]['arrchildid'];
    $keche_condition=$do->getSQLInfo($keche_lev,$cityid,$order);
    $keche=$db->getAll($keche_condition);
    //乘用：
    //微型 436 $weixing
    $weixing_lev = $levels[436]['arrchildid'];
    $weixing_condition=$do->getSQLInfo($weixing_lev,$cityid,$order);
    $weixing=$db->getAll($weixing_condition);
   //小型 437 $xiaoxing
    $xiaoxing_lev = $levels[437]['arrchildid'];
    $xiaoxing_condition=$do->getSQLInfo($xiaoxing_lev,$cityid,$order);
    $xiaoxing=$db->getAll($xiaoxing_condition);

    //紧凑型 438 $jincouxing
    $jincouxing_lev = $levels[438]['arrchildid'];
    $jincouxing_condition=$do->getSQLInfo($jincouxing_lev,$cityid,$order);
    $jincouxing=$db->getAll($jincouxing_condition);

    //中型 439 $zhongxing
    $zhongxing_lev = $levels[439]['arrchildid'];
    $zhongxing_condition=$do->getSQLInfo($zhongxing_lev,$cityid,$order);
    $zhongxing=$db->getAll($zhongxing_condition);

    //中大型 440 $zhongdaxing
    $zhongdaxing_lev = $levels[440]['arrchildid'];
    $zhongdaxing_condition=$do->getSQLInfo($zhongdaxing_lev,$cityid,$order);
    $zhongdaxing=$db->getAll($zhongdaxing_condition);

    //豪华型 441
    $haohuaxing_lev = $levels[441]['arrchildid'];
    $haohuaxing_condition=$do->getSQLInfo($haohuaxing_lev,$cityid,$order);
    $haohuaxing=$db->getAll($haohuaxing_condition);

    if($page == 1 && $kw) keyword($kw, $items, $moduleid);
}
$seo_file = 'list';
include DT_INC.'/seo.inc.php';
include template('index', $module);
